<?php 
	include ("../../config/koneksi.php");
	$q = "select * from master_lab";
	$r = mysql_query($q);
	
	$id = $_GET['id'];
	
	$content = "NO;KODE;NAMA TINDAKAN LABORATORIUM;TARIF\n";
	while ($data = mysql_fetch_array($r)) {
		$cek = mysql_query("select id_tarif from tarif_laboratorium where id_ppk = $id and id_lab = $data[id_lab]");
		$jml = mysql_num_rows($cek);
		
		if($jml == 0){
			$no++;
			$content .= "$no;$data[id_lab];$data[nama_lab];$data[tarif]\n";
		}
	};

	header("Content-type: text/csv");
	header("Content-Disposition: attachment; filename=master_lab.csv");
	header("Pragma: no-cache");
	header("Expires: 0");
	echo $content;
?>